package fr.emse.tatiana.filter;

import java.util.*;
import java.io.File;
import java.io.IOException;

public class TempFileFactory {
	private static String TEMP_FILE_SEED = "tat";
	private static String TEMP_FILE_SUFFIX = ".tat";
	
	private static List<String> given = new Vector<String>();
	
	
	public static String getName() throws IOException {
		String name = File.createTempFile(TEMP_FILE_SEED, TEMP_FILE_SUFFIX).getPath();
		given.add(name);
		return name;
	}
	
	public static void dispose() {
		while (given.size()>0) {
		    String s=given.get(0);
			new File(s).delete();
			given.remove(0);
		}
	}
	
}
